﻿using System;

namespace DBCore.Attr
{
    [AttributeUsageAttribute(AttributeTargets.Class)]
    public class EntityAttribute : System.Attribute
    {
        public string Name { get; set; }
        /// <summary>
        /// 主鍵
        /// </summary>
        public string Primarykey { get; set; }
        /// <summary>
        /// 標題列
        /// </summary>
        public string TitleColumn { get; set; }
        /// <summary>
        /// 針對的數據庫配置
        /// </summary>
        public string Database { get; set; }
        public EntityAttribute()
        {
            Primarykey = "id";
            Database = "default";
            TitleColumn = "name";
        }
        public EntityAttribute(string name)
        {
            Name = name;
            Primarykey = "id";
            Database = "default";
            TitleColumn = "name";
        }
        public EntityAttribute(string name, string primarykey)
        {
            Name = name;
            Primarykey = primarykey;
            Database = "default";
            TitleColumn = "name";
        }
        public EntityAttribute(string name, string primarykey, string database)
        {
            Name = name;
            Primarykey = primarykey;
            Database = database;
            TitleColumn = "name";
        }
        public EntityAttribute(string name, string primarykey, string database,string title)
        {
            Name = name;
            Primarykey = primarykey;
            Database = database;
            TitleColumn = title;
        }
    }
}
